import { createElement, HTMLAttributes, type FC } from 'react';
import classNames from 'classnames';

import { statisticLabelDefaultProps } from './defaultProps';
import type { StatisticLabelOptions } from './type';

export interface StatisticLabelProps extends StatisticLabelOptions, HTMLAttributes<HTMLDivElement> {}

const StatisticLabel: FC<StatisticLabelProps> = (props) => {
  const { className, children, forwardedRef, ...statisticLabelProps } = props;

  return createElement(
    'div',
    { ref: forwardedRef, className: classNames('label', className), ...statisticLabelProps },
    children,
  );
};

StatisticLabel.displayName = 'StatisticLabel';
StatisticLabel.defaultProps = statisticLabelDefaultProps;

export default StatisticLabel;
